var courseMgtBaseURL = "/edu/e/coursemgt";
var jsonContentType = "application/json; charset=utf-8";

function addInstitute() {
	var institute = {
		name :  $('#name').val(),
		code :  $('#code').val(),
		addressLine1 :  $('#addressLine1').val(),
		addressLine2 :  $('#addressLine2').val(),
		addressLine3 :  $('#addressLine3').val(),
		city :  $('#city').val(),
		state :  $('#state').val(),
		country :  $('#country').val(),
		phone1 :  $('#phone1').val(),
		phone2 :  $('#phone2').val(),
		website : $('#website').val()
	};
$.ajax({
	type: "POST",  
	url: courseMgtBaseURL + "/institute",  
	data: JSON.stringify(institute),
	contentType:jsonContentType,
	success: function(response){  
		$('#info').html(response);
	},  
	error: function(e){  
	  alert('Error: ' + e);  
	}  
	})
}


function addBranch() {
	var branch = {
		code :  $('#code').val(),
		description : $('#description').val();
		institute : {
			code : "PEC"
		}
	};
	$.ajax({
		type: "POST",  
		url: courseMgtBaseURL + "/branch",  
		data: JSON.stringify(branch),
		contentType:jsonContentType,
		success: function(response){  
			$('#info').html(response);
		},  
		error: function(e){  
		  alert('Error: ' + e);  
		}  
		})
}